package com.smartfast4j.backend.common.util;


import com.smartfast4j.backend.common.redis.JedisClient;
import com.smartfast4j.backend.common.redis.RedisClientFactory;
import org.apache.log4j.Logger;

/**
 * Created by gacl on 2017/3/14.
 */
public class CacheUtil {

    private static final Logger logger = Logger.getLogger(CacheUtil.class);

    private static JedisClient jedisClient = RedisClientFactory.getDefaultRedisClient();

    public static void setString(String key,String value){
        jedisClient.set(key,value);
    }

    public static String getString(String key){
        return jedisClient.get(key);
    }

    public static <T> void setObject(String key, T obj){
        jedisClient.setObject(key,obj);
    }

    public static <T> T getObject(String key, Class<T> clazz){
        return jedisClient.getObject(key, clazz);
    }

    public static void delete(String key){
        jedisClient.del(key);
    }
}
